﻿<UserControl x:Class="TFDP.VsPackage.Forms.QueueMonitorContent"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             x:Name="uc">
    <UserControl.Resources>
        <DataTemplate x:Key="queueItemTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=Type}" Margin="0,0,4,0" FontWeight="Bold" />
                <TextBlock Text="{Binding Path=Name}" Margin="0,0,4,0" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="comboTemplate">
            <TextBlock Text="{Binding Path=ProjectName}" />
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Margin="4" Width="Auto" HorizontalAlignment="Stretch">
            <ComboBox Name="processorSelector" 
                      Margin="0,0,36,0" 
                      SelectionChanged="processorSelector_SelectionChanged" 
                      ItemsSource="{Binding Path=Processors,ElementName=uc}" 
                      HorizontalAlignment="Stretch" 
                      Height="Auto" 
                      ItemTemplate="{StaticResource comboTemplate}" />
            <Button Margin="0,0,18,0" Width="16" Height="16" Name="startButton" Click="startButton_Click" HorizontalAlignment="Right" IsEnabled="{Binding Path=SelectedItem.IsStopped,ElementName=processorSelector,FallbackValue=False}">
                <Button.Content>
                    <Image Source="/TFDP.VsPackage;component/Resources/start.gif" />
                </Button.Content>
            </Button>
            <Button Width="16" Height="16" Name="stopButton" Click="stopButton_Click" HorizontalAlignment="Right" IsEnabled="{Binding Path=SelectedItem.IsRunning,ElementName=processorSelector,FallbackValue=False}">
                <Button.Content>
                    <Image Source="/TFDP.VsPackage;component/Resources/stop.gif" />
                </Button.Content>
            </Button>
        </Grid>
        <ListBox Name="queuedItems" Grid.Row="1" Margin="4,0,4,0" ItemTemplate="{StaticResource queueItemTemplate}" />
        <Button Name="clearButton" Content="Clear" Click="clearButton_Click" Grid.Row="2" HorizontalAlignment="Right" Width="60" Margin="4" IsEnabled="{Binding Path=HasItems,ElementName=queuedItems}" />
    </Grid>
</UserControl>
